package com.weaver.drools.business.sys.user.service.impl;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.weaver.drools.business.sys.user.service.IUUsrUser36Service;
import com.weaver.drools.common.dao.UUsrUser36Dao;
import com.weaver.drools.common.entity.UUsrUser36;
import com.weaver.drools.common.utils.PageTag;
/**
 * 
 *  @application name:
 *  @author: zhouxinlei 
 *  @time：2018年6月27日
 *  @version：ver 1.1
 */
@Service
public class UUsrUser36ServiceImpl implements IUUsrUser36Service{
	
	@Resource
	public UUsrUser36Dao user36Dao;

	@Override
	public void deleteUUsrUser36(Long Id) {
		user36Dao.deleteById(Id);
	}

	@Override
	public void saveUUsrUser36(UUsrUser36 user) {
		user36Dao.saveOrUpdate(user);
	}

	@Override
	public void updateUUsrUser36(UUsrUser36 user) {
		user36Dao.saveOrUpdate(user);
	}

	@Override
	public List<UUsrUser36> findUUsrUser36List() {
		List<UUsrUser36> list = user36Dao.findAll();
		return list;
	}

	@Override
	public UUsrUser36 findById(Long userid) {
		return user36Dao.findUUsrUser36ByUserid(userid);
	}

	@Override
	public PageTag<UUsrUser36> findUUsrUser36List(int currentNum, String showname,Long sexid) {
		String hql = " from UUsrUser36 where 1=1";
		if (showname!=null&&!"".equals(showname)) {
			hql+=" and showname ='"+showname+"'";
		}
		if (sexid!=null&&!"".equals(sexid)) {
			hql+=" and DSex35.sexid = "+sexid;
		}
		PageTag<UUsrUser36> pageList = user36Dao.findPage(currentNum, hql, null);
		return pageList;
	}

	@Override
	public UUsrUser36 findUUsrUser36ByUserNamePwd(Map<String, Object> map) {
		String hql = " from UUsrUser36 where 1=1";
		hql+=" and username ='"+map.get("username")+"'";
		hql+=" and password ='"+map.get("password")+"'";
		return user36Dao.findEntity(hql);
	}

}
